-- attack_corriosion
-- created by shuzy
-- 攻击附加腐蚀

return {
    apply = function(prop, baseValue)
        return prop[2];
    end,

    -- 攻击触发
    trigger = function(who, prop, arg)
        local target = arg;

        -- 概率触发
        local rand = DungeonM.getRandSeed("attack_corriosion") % 1000;

        if rand > prop[3] then
            return;
        end

        local propId = PropM.getPropId("corriosion");
        -- 每回合掉血（魔力*n%）
        local v = math.modf(ME.user:queryAttrib("magic") * prop[2] / 1000);
        -- 降攻百分比，暂定25%
        local force = 250;

        -- 减益状态
        local effectRound = CombatM.getRound() + prop[4];
        local arr = ({ propId, force, v, effectRound, });

        local condition = {
            ["prop"] = arr,
            ["end_round"] = effectRound,
        };

        -- 附加状态
        CombatStatusM.applyStatus(target, "aging", condition);

        -- 触发特技发动事件
        EventMgr.fire(event.SPECIAL_SKILL_TRIGGER, { propId = prop[1] });

        return arr;
    end,

    record = function(target, prop, path)
        return false;
    end
};
